home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 April: Mac OS SDK / Dev.CD Apr 97 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Interfaces / CIncludes / OpenTptXTI.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-02-14  |  5.7 KB  |  210 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        OpenTptXTI.h
  3.  
  4.     Contains:    Prototypes for XTI-compatible routines for
  5.                 Open Transport
  6.  
  7.  
  8.     Change History (most recent first):
  9.  
  10.          <3>     2/13/96    mjq        Add pragma aligns
  11.          <2>     8/16/95    mjq        Fix up the urequest/ureply functions to take t_unitrequest and
  12.                                     t_unitreply structures.
  13.          <1>     7/31/95    mjq        • Started over from OpenTransport project
  14.  
  15.     To Do:
  16.  
  17. */
  18.  
  19. #ifndef __OPENTPTXTI__
  20. #define __OPENTPTXTI__
  21.  
  22. #ifndef __OPENTRANSPORT__
  23. #include <OpenTransport.h>
  24. #endif
  25.     
  26. #if PRAGMA_ALIGN_SUPPORTED
  27. #pragma options align=mac68k
  28. #endif
  29.  
  30. /*******************************************************************************
  31. ** Global Variables
  32. ********************************************************************************/
  33.                     
  34. extern int    t_errno;
  35.  
  36. /*******************************************************************************
  37. ** Structures
  38. **
  39. ** WARNING: These structures will only work if "int"s are the
  40. **            same size as "size_t", "long", and "UInt32"
  41. ********************************************************************************/
  42.  
  43. struct netbuf
  44. {
  45.     unsigned int    maxlen;
  46.     unsigned int    len;
  47.     char*            buf;
  48. };
  49.  
  50. struct t_bind 
  51. {
  52.     struct netbuf        addr;
  53.     unsigned            qlen;
  54. };
  55.  
  56. struct t_optmgmt 
  57. {
  58.     struct netbuf    opt;
  59.     long            flags;
  60. };
  61.  
  62. struct t_discon 
  63. {
  64.     struct netbuf    udata;
  65.     int             reason;
  66.     int             sequence;
  67. };
  68.  
  69. struct t_call 
  70. {
  71.     struct netbuf    addr;
  72.     struct netbuf    opt;
  73.     struct netbuf    udata;
  74.     int             sequence;
  75. };
  76.  
  77. struct t_unitdata 
  78. {
  79.     struct netbuf    addr;
  80.     struct netbuf    opt;
  81.     struct netbuf    udata;
  82. };
  83.  
  84. struct t_uderr 
  85. {
  86.     struct netbuf    addr;
  87.     struct netbuf    opt;
  88.     long            error;
  89. };
  90.  
  91. /*    -------------------------------------------------------------------------
  92.     Transaction data structures
  93.     ------------------------------------------------------------------------- */
  94.  
  95. struct t_request        
  96. {
  97.     struct netbuf    data;
  98.     struct netbuf    opt;
  99.     long            sequence;
  100. };
  101.  
  102. struct t_reply        
  103. {
  104.     struct netbuf    data;
  105.     struct netbuf    opt;
  106.     long            sequence;
  107. };
  108.  
  109. struct t_unitrequest
  110. {
  111.     struct netbuf    addr;
  112.     struct netbuf    opt;
  113.     struct netbuf    udata;
  114.     long            sequence;
  115. };
  116.  
  117. struct t_unitreply
  118. {
  119.     struct netbuf    opt;
  120.     struct netbuf    udata;
  121.     long            sequence;
  122. };
  123.  
  124. struct t_opthdr
  125. {
  126.     unsigned long    len;        /* total length of option = sizeof(struct t_opthdr) +    */
  127.                                 /*                        length of option value in bytes    */
  128.     unsigned long    level;        /* protocol affected */
  129.     unsigned long    name;        /* option name */
  130.     unsigned long    status;        /* status value */
  131.                                 /* followed by the option value */
  132. };
  133.  
  134.  
  135. /*******************************************************************************
  136. ** XTI Interfaces
  137. ********************************************************************************/
  138.  
  139. #ifdef __cplusplus
  140. extern "C" {
  141. #endif
  142.  
  143. extern pascal int     t_accept(int fd, int resfd, struct t_call* call);
  144. extern pascal char* t_alloc(int fd, int struct_type, int fields);
  145. extern pascal int     t_bind(int fd, struct t_bind* req, struct t_bind* ret);
  146. extern pascal int     t_close(int fd);
  147. extern pascal int     t_connect(int fd, struct t_call* sndcall, struct t_call* rcvcall);
  148. extern pascal int     t_free(char* ptr, int struct_type);
  149. extern pascal int     t_getinfo(int fd, struct t_info* info);
  150. extern pascal int     t_getstate(int fd);
  151. extern pascal int     t_listen(int fd, struct t_call* call);
  152. extern pascal int     t_look(int fd);
  153. extern pascal int     t_open(char* path, int oflag, struct t_info* info);
  154. extern pascal int    t_blocking(int fd);
  155. extern pascal int    t_nonblocking(int fd);
  156. extern pascal int     t_optmgmt(int fd, struct t_optmgmt* req, struct t_optmgmt* ret);
  157. extern pascal int     t_rcv(int fd, char* buf, size_t nbytes, int* flags);
  158. extern pascal int     t_rcvconnect(int fd, struct t_call* call);
  159. extern pascal int     t_rcvdis(int fd, struct t_discon* discon);
  160. extern pascal int     t_rcvrel(int fd);
  161. extern pascal int     t_rcvudata(int fd, struct t_unitdata* unitdata, int* flags);
  162. extern pascal int     t_rcvuderr(int fd, struct t_uderr* uderr);
  163. extern pascal int     t_snd(int fd, char* buf, size_t nbytes, int flags);
  164. extern pascal int     t_snddis(int fd, struct t_call* call);
  165. extern pascal int     t_sndrel(int fd);
  166. extern pascal int     t_sndudata(int fd, struct t_unitdata* unitdata);
  167. extern pascal int     t_sync(int fd);
  168. extern pascal int     t_unbind(int fd);
  169. extern pascal int     t_error(char* errmsg);
  170. extern pascal int     t_getprotaddr(int fd, struct t_bind* boundaddr, struct t_bind* peeraddr);
  171. //
  172. // Apple extensions
  173. //
  174. extern pascal int    t_isnonblocking(int fd);
  175. extern pascal int    t_asynchronous(int fd);
  176. extern pascal int    t_synchronous(int fd);
  177. extern pascal int    t_issynchronous(int fd);
  178. /*
  179. ** Not XTI standard functions, but extensions for transaction endpoints    
  180. */
  181. extern pascal int    t_sndrequest(int fd, struct t_request*, int flags);
  182. extern pascal int    t_rcvreply(int fd, struct t_reply*, int* flags);
  183. extern pascal int    t_rcvrequest(int fd, struct t_request*, int* flags);
  184. extern pascal int    t_sndreply(int fd, struct t_reply*, int flags);
  185. extern pascal int    t_cancelrequest(int fd, long sequence);
  186. extern pascal int    t_cancelreply(int fd, long sequence);
  187.  
  188. extern pascal int    t_sndurequest(int fd, struct t_unitrequest*, int flags);
  189. extern pascal int    t_rcvureply(int fd, struct t_unitreply*, int* flags);
  190. extern pascal int    t_rcvurequest(int fd, struct t_unitrequest*, int* flags);
  191. extern pascal int    t_sndureply(int fd, struct t_unitreply*, int flags);
  192. extern pascal int    t_cancelurequest(int fd, long sequence);
  193. extern pascal int    t_cancelureply(int fd, long sequence);
  194.  
  195. extern pascal int    t_resolveaddr(int fd, struct t_bind* reqAddr, struct t_bind* retAddr, OTTimeout timeout);
  196. extern pascal int    t_cancelsynchronouscalls(int fd);
  197. extern pascal int    t_installnotifier(int fd, OTNotifyProcPtr proc, void* contextPtr);
  198. extern pascal void    t_removenotifier(int fd);
  199.  
  200. #ifdef __cplusplus
  201. }
  202. #endif
  203.  
  204. #if PRAGMA_ALIGN_SUPPORTED
  205. #pragma options align=reset
  206. #endif
  207.  
  208. #endif    /* __OPENTRANSPORT__ */
  209.  
  210.